<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>Descriptor (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">proto2.Descriptor</span>
        <span>Extends</span>
        <span class="fn-name">
          Object
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    A class which describes a Protocol Buffer 2 Message.
  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="closure_goog_proto2_descriptor.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/closure/goog/proto2/descriptor.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.proto2.Descriptor</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
</table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.proto2.Descriptor(<span><span class="arg">messageType</span>,&nbsp;<span class="arg">metadata</span>,&nbsp;<span class="arg">fields</span></span>)
  </div>

   <h3>Parameters</h3>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">messageType</span>
        : <div class="fullType"><span>?</span><span class="type">function (new:goog.proto2.Message): </span></div>
        <div class="entryOverview">Constructor for the message class that this descriptor describes.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">metadata</span>
        : <div class="fullType"><span class="type">{containingType: (goog.proto2.Message</span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined), fullName: (string</span><span>&nbsp;|&nbsp;</span><span class="type">undefined), name: (string</span><span>&nbsp;|&nbsp;</span><span class="type">undefined)}</span></div>
        <div class="entryOverview">The metadata about the message that will be used to construct this descriptor.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">fields</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;<span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
        <div class="entryOverview">The fields of the message described by this descriptor.</div>
     </td>
   </tr>
  </table>


<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_proto2_Descriptor.html">
              goog.proto2.Descriptor
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.createMessageInstance"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">createMessageInstance<span class="args">()</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="class_goog_proto2_Message.html">goog.proto2.Message</a></span></div>
      </div>


     <div class="entryOverview">
       Creates an instance of the message type that this descriptor
describes.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="class_goog_proto2_Message.html">goog.proto2.Message</a></span></div>&nbsp;
            The instance of the message.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line198">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.findFieldByName"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">findFieldByName<span class="args">(<span class="arg">name</span>)</span>
        </span>
        &#8658; <div class="fullType">(<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
      </div>


     <div class="entryOverview">
       Returns the field matching the given name, if any. Note that
this method searches over the *original* name of the field,
not the camelCase version.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span></div>
        <div class="entryOverview">The field name for which to search.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType">(<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>&nbsp;
            The field found, if any.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line169">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.findFieldByTag"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">findFieldByTag<span class="args">(<span class="arg">tag</span>)</span>
        </span>
        &#8658; <div class="fullType">(<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
      </div>


     <div class="entryOverview">
       Returns the field matching the given tag number, if any.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">tag</span>
        : <div class="fullType">(<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>
        <div class="entryOverview">The field tag number for which to search.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType">(<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>&nbsp;
            The field found, if any.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line186">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.getContainingType"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getContainingType<span class="args">()</span>
        </span>
        &#8658; <div class="fullType">(<span class="type"><a href="class_goog_proto2_Descriptor.html">goog.proto2.Descriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>
      </div>


     <div class="entryOverview">
       Returns the descriptor of the containing message type or null if none.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType">(<span class="type"><a href="class_goog_proto2_Descriptor.html">goog.proto2.Descriptor</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span>)</div>&nbsp;
            The descriptor.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line113">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.getFields"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getFields<span class="args">()</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;</div>
      </div>


     <div class="entryOverview">
       Returns the fields in the message described by this descriptor ordered by
tag.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;</div>&nbsp;
            The array of field descriptors.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line129">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.getFieldsMap"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getFieldsMap<span class="args">()</span>
        </span>
        &#8658; <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>,<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;</div>
      </div>


     <div class="entryOverview">
       Returns the fields in the message as a key/value map, where the key is
the tag number of the field. DO NOT MODIFY THE RETURNED OBJECT. We return
the actual, internal, fields map for performance reasons, and changing the
map can result in undefined behavior of this library.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>,<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;</div>&nbsp;
            The field map.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line155">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.getFullName"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getFullName<span class="args">()</span>
        </span>
        &#8658; <div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>
      </div>


     <div class="entryOverview">
       Returns the full name of the message, if any.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>&nbsp;
            The name.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line103">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.proto2.Descriptor.prototype.getName"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getName<span class="args">()</span>
        </span>
        &#8658; <div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>
      </div>


     <div class="entryOverview">
       Returns the name of the message, if any.
     </div>


    <! -- Method details -->
    <div class="entryDetails">

   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>&nbsp;
            The name.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line93">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_proto2_Descriptor.html">
              goog.proto2.Descriptor
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.proto2.Descriptor.prototype.containingType_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">containingType_</span>
        : <div class="fullType">(<span class="type"><a href="class_goog_proto2_Message.html">goog.proto2.Message</a></span><span>&nbsp;|&nbsp;</span><span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type">undefined</span>)</div>
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line72">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.proto2.Descriptor.prototype.fields_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">fields_</span>
        : <div class="fullType"><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>,<span class="type"><a href="class_goog_proto2_FieldDescriptor.html">goog.proto2.FieldDescriptor</a></span>&gt;</div>
     </div>


     <div class="entryOverview">
       The fields of the message described by this descriptor.
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line79">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.proto2.Descriptor.prototype.fullName_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">fullName_</span>
        : <div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line66">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.proto2.Descriptor.prototype.messageType_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">messageType_</span>
        : <div class="fullType"><span>?</span><span class="type">function (new:goog.proto2.Message): </span></div>
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line54">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.proto2.Descriptor.prototype.name_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">name_</span>
        : <div class="fullType">(<span class="type">null</span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>)</div>
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="closure_goog_proto2_descriptor.js.source.html#line60">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>










<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package proto2</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="proto2.Descriptor"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
